package com.atguigu.ioc.factory;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;

// 这个类要生效，也是配置到 IOC 容器中
public class AtguiguBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        // 1、根据 bean 的 id 获取对应的 BeanDefinition
        BeanDefinition beanDefinition = beanFactory.getBeanDefinition("happyMachine4");

        // 2、获取 bean 标签的 class 属性值
        String beanClassName = beanDefinition.getBeanClassName();
        System.out.println("beanClassName = " + beanClassName);
    }
}
